<?php
class Exceptions
{
	private static $type = array(
		"error" => "[Error] ",
		"warning" => "[Warning] ",
		"notice" => "[Notice] "
	);

	private static $instance = null;
	private static $customError = array();

	public static function fatal($exitMessage)
	{
		die( self::$type["error"] . $exitMessage );
	}

	public static function warning($message)
	{
		echo( self::$type["warning"] . $message . "<br />" );
	}

	public static function getInstance()
	{
		if ( !self::$instance )
			self::$instance = new Exceptions();

		return( self::$instance );
	}

	public static function registerCustom($errorName, $message)
	{
		self::$customError[$errorName] = $message;
	}

    public function __call($method, $arguments)
	{
		if ( isset(self::$customError[$method]) )
		{
			return( self::$customError[$method] );
		}
		else
			return(null);
	}
}
?>
